package com.jstzrmyy.mams;

import android.app.ActionBar;
import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class AppPreferenceActivity extends Activity  {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_app_preference);
		// Show the custom action bar but hide the home icon and title
		View customActionBarView = getLayoutInflater().inflate(R.layout.custom_actionbar, null);
		ActionBar actionBar = getActionBar(); 
		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,  
		        ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME |  
		        ActionBar.DISPLAY_SHOW_TITLE);  
		actionBar.setCustomView(customActionBarView);  

	    Button btn = (Button)findViewById(R.id.btn_goback_from_preference);
	    btn.setOnClickListener(new View.OnClickListener() {
	    	@Override
	    	public void onClick(View v) {
	    		finish(); 	    		
	    	}
	    }); 
		// Display the fragments
		FragmentManager manager = getFragmentManager();
		FragmentTransaction trans = manager.beginTransaction();
		OrientationPreferenceFragment orientFragment = new OrientationPreferenceFragment();
		trans.replace(R.id.app_preference_activity_view, orientFragment);
		trans.commit();
	}
	
}
